<div class="content-form edit-aluno">
    
    <h2><?php echo $this->titulo; ?></h2>
    
    <?php echo $this->partial('aluno/menu.phtml', array('urlfoto'=>$this->urlfoto,'modulo'=>$this->modulo,'controller' => $this->controller, 'action' => $this->action, 'data' => $this->data)); ?>
    
    <div class="content-list" style="float: left">
        <h2>Materiais</h2>
        <table id="tlist">
            <thead>
                <tr>
                    <th>Material</th>
                    <th>Recebimento</th> 
                    <th>Data</th>
                </tr>
            </thead>
            <tbody>
                <?php
                if($this->mat['CUR_ID'] > 0){ 
                $cur = new Sistema_Model_DbTable_Curso();
                $cur = $cur->fetchRow('CUR_ID = '.$this->mat['CUR_ID']);
                
                if($cur['MTL_ID']){ 
                $obj = new Sistema_Model_DbTable_Material();  
                $mats =  $obj->fetchAll('MTL_ID in(' . $cur['MTL_ID'].')'); 
                foreach($mats as $mat){ 
                    $mtm = new Sistema_Model_DbTable_MatriculaHasMaterial();
                    $mtm = $mtm->fetchRow('MAT_ID = '.$this->mat['MAT_ID'].' and MTL_ID = '.$mat['MTL_ID']);
                    $recebido = isset($mtm['MAT_ID']) ? 1:0;
                ?>
                    <tr>
                        <td><?php echo $mat['MTL_NOM']?></td>
                        <td id="td_<?php echo $mat['MTL_ID']?>"><?php if($recebido == 1) echo 'Sim'; else { ?><input type="checkbox" class="clk_rec_mat_alu" value="<?php echo $mat['MTL_ID']?>" id="<?php echo $mat['MTL_ID']?>" itemid="<?php echo $this->mat['MAT_ID']?>" ><?php } ?></td>
                        <td><span id="dt_<?php echo $mat['MTL_ID']?>"><?php echo Datetools::amd_dma($mtm['MTL_DAT'])?></span></td>
                    </tr>
                <?php } 
                } } ?>
            </tbody>
        </table>
    </div>
</div>